package com.tuanzi.loan.schedule.receipt;

import com.base.common.log.LogService;
import com.tuanzi.loan.business.service.statistics.LoanHitLibraryResultService;
import com.tuanzi.loan.core.aspect.Debug;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Auther: hequnayu
 * @Date: 2019/6/5 17:26
 * @Description:
 */
@Debug
@Slf4j
@Service
@Transactional
public class StatisticsCleanHitNewUserScheduler {

    @Autowired
    private LoanHitLibraryResultService loanHitLibraryResultService;

    @Scheduled(cron = "${cron.statistics-clean-hit-task}")
    public void statisticNewByDay(){
        LogService.info("每日撞库新用户清理任务执行");
        loanHitLibraryResultService.deleteNewUserByDay();
    }

    @Scheduled(cron = "${cron.statistics-clean-hit-old-task}")
    public void statisticOldUserByWeeks(){
        LogService.info("每两周撞库新用户清理任务执行");
        loanHitLibraryResultService.deleteOldUserByWeeks();
    }
}
